/**
 * 问卷定义
 *
 * @Author: 殷世杰
 * @Date: 2019/09/20
 */
import axios from '@/api/fetch';
import * as types from './types';
import SERVER from '@/api/server';

// 查询答案列表信息
export const getAnswerInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryAnswerGroup`, { params });

// 新增答案信息
export const saveAnswerInfo = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/insertAnswerGroupInfo`, params, { mark: types.SAVE });

// 修改答案信息
export const editAnswerInfo = params => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/updateAnswerGroupInfo`, params, { mark: types.SAVE });

// 根据答案组ID查询选项
export const queryAnswersPagByIds = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryAnswerByGroupId`, { params });

// 查询答案信息编辑页面信息
export const getAnswerEditInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}//questionnaire/queryAnswerGroupById`, {params});

// 根据ID删除答案及选项信息
export const delAnswerGroupAndAnswerById = params => axios.delete(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/deleteAnswerGroupInfo`, {params});

// 查询问题列表信息
export const getQuestionnaireInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestion`, { params });

// 根据ID查询问题下的答案
export const queryQuestionPagById = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}//questionnaire/queryAnswerQuestionByQuestionId`, { params });

// 根据ID查询问题详情
export const queryQuestionInfoById = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionById`, { params });

//新增问题
export const addQuestionnaire = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/addQuestion`, params);

//修改问题
export const editQuestionnaire = params => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/updateQuestion`, params);

// 删除问题
export const delQuestionnaireInfo = params => axios.delete(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/deleteQuestionById`, { params });

// 查询问卷列表
export const queryQuestionnaireInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionnaire`, { params });

// 查询问卷下的问题信息
export const queryQuestionByQuestionnaireId = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionByQuestionnaireId`, { params });

//新增问卷
export const saveQuestionnaire = params => axios.post(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/insertQuestionnaire`, params);

//删除问卷
export const delQuestionnaire = params => axios.delete(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/deleteQuestionnaireById`, { params });

// 查询问卷信息编辑页面信息
export const getQuestionnaireEditInfo = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionnaireById`, { params });

// 修改问卷
export const editQuestionnaireInfo = params => axios.put(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/updateQuestionnaire`, params);

//根据关爱类型获取问卷列表
export const queryQuestionnaireByType = params => axios.get(`${SERVER.DMSCLOUD_SYSBASEDATA}/questionnaire/queryQuestionnaireByType`, { params });
